package com.myworld.web;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
* @Description:使用 @ConfigurationProperties 读取application 配置文件
* 通过注解@ConfigurationProperties(prefix="配置文件中的key的前缀")可以将配置
* 文件中的配置自动与实体进行映射
*/
@Controller
@ConfigurationProperties(prefix = "person")
public class QuickStartController {
	private String name;
	private Integer age;

	@RequestMapping("/quick")
	@ResponseBody
	public String quick() {
		return "springboot 访问成功! name=" + name + ",age=" + age;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setAge(Integer age) {
		this.age = age;
	}
}